//
//  main.m
//  secound-oc.class
//
//  Created by 郭志远 on 2023/11/23.
//

#import <Foundation/Foundation.h>

@interface Person : NSObject
{
    @public
    int _age;
    double _height;
    double _weight;
}

- (void)eat:(char *)food;

- (void)sleep;

- (void)walk;

@end

@implementation Person

- (void)eat:(char *)food
{
    NSLog(@"吃%s", food);
}

- (void)sleep
{
    NSLog(@"开始睡觉");
}

- (void)walk
{
    NSLog(@"开始散步");
}

@end
int main(int argc, const char * argv[]) {
    /*
     1.开辟存储空间，通过new方法创建对象，会在堆内存中开辟一块存储空间
     2.初始化所有属性
     3.返回指针地址
     */
    Person *p = [Person new];
    p->_age = 10;
    p->_height = 110;
    p->_weight = 20;
    
    NSLog(@"age = %i, height = %f, weight = %f", p->_age, p->_height, p->_weight);
    return 0;
}
